<template>
  <view class="flex flex-col items-center">
    <text class="text-center text-red-600 text-lg">{{ counter.count }}</text>
    <view class="w-full">
      <nut-button size="large" type="primary" @tap="onAdd">ADD</nut-button>
    </view>
  </view>
</template>

<script>
import { useCounterStore } from '@/stores/counter'

export default {
  setup() {
    const counter = useCounterStore()

    const onAdd = () => {
      counter.count++

      // with autocompletion ✨
      // counter.$patch({count: counter.count + 1})

      // or using an action instead
      // counter.increment()
    }

    return {
      counter,
      onAdd
    }
  }
}
</script>

<style>
.title {
  font-size: 32px;
}

.button {
  border: 1px solid lightgray;
  padding: 5px 10px;
}
</style>